﻿<Application 
    x:Class="Flickr.Sample.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"       
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"    
    xmlns:agfx="clr-namespace:AgFx;assembly=AgFx"
    xmlns:converters="clr-namespace:AgFx.Converters;assembly=AgFx"
    xmlns:mscorlib ="clr-namespace:System;assembly=mscorlib"
    >

    <!--Application Resources-->
    <Application.Resources>

        <!--Add your flickr AppId below -->
        <mscorlib:String x:Key="apiKey">[Flickr Secret]</mscorlib:String>

        <!--Add your flickr nsid below -->
        <mscorlib:String x:Key="defaultUserId">[Flickr UserID]</mscorlib:String>
        
        <converters:VisibilityConverter x:Key="visibilityConverter"/>
        <converters:StringFormatConverter x:Key="stringFormatConverter"/>
        
        <Style
            x:Key="SuperPerf"
            TargetType="ProgressBar">
            <Setter
                Property="Foreground"
                Value="{StaticResource PhoneAccentBrush}" />
            <Setter
                Property="Background"
                Value="{StaticResource PhoneAccentBrush}" />
            <Setter
                Property="Maximum"
                Value="100" />
            <Setter
                Property="IsHitTestVisible"
                Value="False" />
            <Setter
                Property="Padding"
                Value="{StaticResource PhoneHorizontalMargin}" />
            <Setter
                Property="Template">
                <Setter.Value>
                    <ControlTemplate
                        TargetType="ProgressBar">
                        <Grid>
                            <Grid.Resources>
                                <ExponentialEase
                                    EasingMode="EaseOut"
                                    Exponent="1"
                                    x:Key="ProgressBarEaseOut" />
                                <ExponentialEase
                                    EasingMode="EaseIn"
                                    Exponent="1"
                                    x:Key="ProgressBarEaseIn" />
                            </Grid.Resources>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup
                                    x:Name="CommonStates">
                                    <VisualState
                                        x:Name="Determinate" />
                                    <VisualState
                                        x:Name="Indeterminate">
                                        <Storyboard
                                            Duration="00:00:04.4"
                                            RepeatBehavior="Forever">
                                            <ObjectAnimationUsingKeyFrames
                                                Storyboard.TargetProperty="Visibility"
                                                Storyboard.TargetName="IndeterminateRoot">
                                                <DiscreteObjectKeyFrame
                                                    KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.0"
                                                Storyboard.TargetProperty="X"
                                                Storyboard.TargetName="R1TT">
                                                <LinearDoubleKeyFrame
                                                    KeyTime="00:00:00.0"
                                                    Value="-240" />
                                                <EasingDoubleKeyFrame
                                                    KeyTime="00:00:00.5"
                                                    Value="-80"
                                                    EasingFunction="{StaticResource ProgressBarEaseOut}" />
                                                <LinearDoubleKeyFrame
                                                    KeyTime="00:00:02.0"
                                                    Value="80" />
                                                <EasingDoubleKeyFrame
                                                    KeyTime="00:00:02.5"
                                                    Value="240"
                                                    EasingFunction="{StaticResource ProgressBarEaseIn}" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.2"
                                                Storyboard.TargetProperty="X"
                                                Storyboard.TargetName="R2TT">
                                                <LinearDoubleKeyFrame
                                                    KeyTime="00:00:00.0"
                                                    Value="-240" />
                                                <EasingDoubleKeyFrame
                                                    KeyTime="00:00:00.5"
                                                    Value="-80"
                                                    EasingFunction="{StaticResource ProgressBarEaseOut}" />
                                                <LinearDoubleKeyFrame
                                                    KeyTime="00:00:02.0"
                                                    Value="80" />
                                                <EasingDoubleKeyFrame
                                                    KeyTime="00:00:02.5"
                                                    Value="240"
                                                    EasingFunction="{StaticResource ProgressBarEaseIn}" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.4"
                                                Storyboard.TargetProperty="X"
                                                Storyboard.TargetName="R3TT">
                                                <LinearDoubleKeyFrame
                                                    KeyTime="00:00:00.0"
                                                    Value="-240" />
                                                <EasingDoubleKeyFrame
                                                    KeyTime="00:00:00.5"
                                                    Value="-80"
                                                    EasingFunction="{StaticResource ProgressBarEaseOut}" />
                                                <LinearDoubleKeyFrame
                                                    KeyTime="00:00:02.0"
                                                    Value="80" />
                                                <EasingDoubleKeyFrame
                                                    KeyTime="00:00:02.5"
                                                    Value="240"
                                                    EasingFunction="{StaticResource ProgressBarEaseIn}" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.6"
                                                Storyboard.TargetProperty="X"
                                                Storyboard.TargetName="R4TT">
                                                <LinearDoubleKeyFrame
                                                    KeyTime="00:00:00.0"
                                                    Value="-240" />
                                                <EasingDoubleKeyFrame
                                                    KeyTime="00:00:00.5"
                                                    Value="-80"
                                                    EasingFunction="{StaticResource ProgressBarEaseOut}" />
                                                <LinearDoubleKeyFrame
                                                    KeyTime="00:00:02.0"
                                                    Value="80" />
                                                <EasingDoubleKeyFrame
                                                    KeyTime="00:00:02.5"
                                                    Value="240"
                                                    EasingFunction="{StaticResource ProgressBarEaseIn}" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.8"
                                                Storyboard.TargetProperty="X"
                                                Storyboard.TargetName="R5TT">
                                                <LinearDoubleKeyFrame
                                                    KeyTime="00:00:00.0"
                                                    Value="-240" />
                                                <EasingDoubleKeyFrame
                                                    KeyTime="00:00:00.5"
                                                    Value="-80"
                                                    EasingFunction="{StaticResource ProgressBarEaseOut}" />
                                                <LinearDoubleKeyFrame
                                                    KeyTime="00:00:02.0"
                                                    Value="80" />
                                                <EasingDoubleKeyFrame
                                                    KeyTime="00:00:02.5"
                                                    Value="240"
                                                    EasingFunction="{StaticResource ProgressBarEaseIn}" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.0"
                                                Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="R1">
                                                <DiscreteDoubleKeyFrame
                                                    KeyTime="0"
                                                    Value="1" />
                                                <DiscreteDoubleKeyFrame
                                                    KeyTime="00:00:02.5"
                                                    Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.2"
                                                Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="R2">
                                                <DiscreteDoubleKeyFrame
                                                    KeyTime="0"
                                                    Value="1" />
                                                <DiscreteDoubleKeyFrame
                                                    KeyTime="00:00:02.5"
                                                    Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.4"
                                                Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="R3">
                                                <DiscreteDoubleKeyFrame
                                                    KeyTime="0"
                                                    Value="1" />
                                                <DiscreteDoubleKeyFrame
                                                    KeyTime="00:00:02.5"
                                                    Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.6"
                                                Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="R4">
                                                <DiscreteDoubleKeyFrame
                                                    KeyTime="0"
                                                    Value="1" />
                                                <DiscreteDoubleKeyFrame
                                                    KeyTime="00:00:02.5"
                                                    Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.8"
                                                Storyboard.TargetProperty="Opacity"
                                                Storyboard.TargetName="R5">
                                                <DiscreteDoubleKeyFrame
                                                    KeyTime="0"
                                                    Value="1" />
                                                <DiscreteDoubleKeyFrame
                                                    KeyTime="00:00:02.5"
                                                    Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <Grid
                                x:Name="IndeterminateRoot"
                                HorizontalAlignment="Center"
                                Margin="{TemplateBinding Padding}">
                                <Rectangle
                                    Fill="{TemplateBinding Foreground}"
                                    Height="4"
                                    IsHitTestVisible="False"
                                    Width="4"
                                    CacheMode="BitmapCache"
                                    x:Name="R1"
                                    Opacity="0">
                                    <Rectangle.RenderTransform>
                                        <TranslateTransform
                                            x:Name="R1TT" />
                                    </Rectangle.RenderTransform>
                                </Rectangle>
                                <Rectangle
                                    Fill="{TemplateBinding Foreground}"
                                    Height="4"
                                    IsHitTestVisible="False"
                                    Width="4"
                                    x:Name="R2"
                                    CacheMode="BitmapCache"
                                    Opacity="0">
                                    <Rectangle.RenderTransform>
                                        <TranslateTransform
                                            x:Name="R2TT" />
                                    </Rectangle.RenderTransform>
                                </Rectangle>
                                <Rectangle
                                    Fill="{TemplateBinding Foreground}"
                                    Height="4"
                                    IsHitTestVisible="False"
                                    CacheMode="BitmapCache"
                                    Width="4"
                                    x:Name="R3"
                                    Opacity="0">
                                    <Rectangle.RenderTransform>
                                        <TranslateTransform
                                            x:Name="R3TT" />
                                    </Rectangle.RenderTransform>
                                </Rectangle>
                                <Rectangle
                                    Fill="{TemplateBinding Foreground}"
                                    Height="4"
                                    IsHitTestVisible="False"
                                    CacheMode="BitmapCache"
                                    Width="4"
                                    x:Name="R4"
                                    Opacity="0">
                                    <Rectangle.RenderTransform>
                                        <TranslateTransform
                                            x:Name="R4TT" />
                                    </Rectangle.RenderTransform>
                                </Rectangle>
                                <Rectangle
                                    Fill="{TemplateBinding Foreground}"
                                    Height="4"
                                    IsHitTestVisible="False"
                                    CacheMode="BitmapCache"
                                    Width="4"
                                    x:Name="R5"
                                    Opacity="0">
                                    <Rectangle.RenderTransform>
                                        <TranslateTransform
                                            x:Name="R5TT" />
                                    </Rectangle.RenderTransform>
                                </Rectangle>
                            </Grid>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </Application.Resources>

    <Application.ApplicationLifetimeObjects>
        <!--Required object that handles lifetime events for the application-->
        <shell:PhoneApplicationService 
            Launching="Application_Launching" Closing="Application_Closing" 
            Activated="Application_Activated" Deactivated="Application_Deactivated"/>
    </Application.ApplicationLifetimeObjects>

</Application>